<?php use_helper('Url') ?>
<?php if (isset($pager)): ?>
  <table cellspacing="0" class="root_table">
    <tbody>
      <tr>
		  
        <th>
			<?php echo link_to_function('<span>Khách hàng</span>', 'sort(\'customer_phone_number\', 1)') ?>
        </th>
        <th>
           	<?php echo link_to_function('<span>Tên sân</span>', 'sort(\'ground_name\', 1)') ?>
        </th>
		<th>
           	<?php echo link_to_function('<span>Giờ đặt</span>', 'sort(\'schedule\', 1)') ?>
        </th>
		<th>
            <?php echo link_to_function('<span>Ngày đặt
</span>', 'sort(\'reserved_date\', 1)') ?>
        </th>
		<th>
           	<?php echo link_to_function('<span>Trạng thái</span>', 'sort(\'status\', 1)') ?>
        </th>
		<th>
			<?php echo 'Ghi chú' ?>
		</th>
		<th>
           	<?php echo 'Giá sân' ?>
        </th>
        <th>
           	<?php echo 'Đã thanh toán' ?>
        </th>
		<th>
		  <?php echo "Thao Tác" ?>
		</th>
      </tr>

	<?php foreach ($pager->getResults() as $order) :?>
    <tr>
        <td style="text-align:left"><?php echo $order->customer_phone_number.' - '.$order->DtCustomer->name  ?></td>
        <td style="text-align:center"><?php echo $order->ground_name ?></td>
        <td style="text-align:center"><?php echo $order->schedule ?></td>
		<td style="text-align:center"><?php echo $order->reserved_date ?></td>
		<td style="text-align:center"><?php echo DtGroundOrder::$status[$order->status] ?></td>
		<td style="text-align:left"><?php echo $order->note ?></td>
		<td style="text-align:center"><?php echo Doctrine_Core::getTable('DtSchedule')->findOneByGroundIdAndSchedule($order->ground_id, $order->schedule)->cost ?></td>
        <td style="text-align:center"><?php echo $order->amount ?></td>
		<td style="text-align:center"><?php echo link_to('Sửa', '@ground_order_edit?order_code='.$order->order_code)?></td>
    </tr>
  <?php endforeach ?>
    </tbody>
  </table>

  <?php if ($pager->haveToPaginate()): ?>
    <div class="pagination">
      <?php if (!$pager->isFirstPage()): ?>
        <?php echo link_to_function("First page", 'listReload('.$pager->getFirstPage().')', array('class' => 'page')) ?>
        <?php echo link_to_function("Prev", 'listReload('.$pager->getPreviousPage().')', array('class' => 'page')) ?>
      <?php endif ?>

      <?php foreach ($pager->getLinks() as $link): ?>
        <?php if ($link == $pager->getPage()): ?>
          <span class="page selected"><?php echo $link ?></span>
        <?php else: ?>
          <?php echo link_to_function($link, 'listReload('.$link.')', array('class' => 'page')) ?>
        <?php endif ?>
      <?php endforeach ?>

      <?php if (!$pager->isLastPage()): ?>
        <?php echo link_to_function("Next", 'listReload('.$pager->getNextPage().')', array('class' => 'page')) ?>
        <?php echo link_to_function("Last page", 'listReload('.$pager->getLastPage().')', array('class' => 'page')) ?>
      <?php endif ?>
    </div>
  <?php endif ?>
<?php endif ?>